package listener;

import data.ChatServerInfo;
import server.Server;



public class ServerListener implements Listener{
	
	public final static String START = "start";
	public final static String SHUTDOWM = "shutdown";
	
	private Server server;
	
	public ServerListener(Server server){
		this.server = server;
	}

	@Override
	public void listen(String command) {
		if (command.equals(SHUTDOWM)&&ChatServerInfo.getInstance().isRunning()) {
			server.shutdown();
		}
		if (command.equals(START)&&!ChatServerInfo.getInstance().isRunning()) {
			server.start();
		}
		
	}

}
